package org.hfy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * PCB规格枚举类
 * 
 * @author hfy
 * @version 1.0
 */
public class PCBSpecEnum {
    
    /**
     * 层数枚举
     */
    @Getter
    @AllArgsConstructor
    public enum LayersEnum {
        LAYER_1("1", "1层"),
        LAYER_2("2", "2层"),
        LAYER_4("4", "4层"),
        LAYER_6("6", "6层"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static LayersEnum fromCode(String code) {
            for (LayersEnum layer : LayersEnum.values()) {
                if (layer.getCode().equals(code)) {
                    return layer;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 板厚枚举
     */
    @Getter
    @AllArgsConstructor
    public enum ThicknessEnum {
        THICKNESS_0_6("0.6", "0.6mm"),
        THICKNESS_0_8("0.8", "0.8mm"),
        THICKNESS_1_0("1.0", "1.0mm"),
        THICKNESS_1_2("1.2", "1.2mm"),
        THICKNESS_1_6("1.6", "1.6mm"),
        THICKNESS_2_0("2.0", "2.0mm"),
        THICKNESS_2_5("2.5", "2.5mm"),
        THICKNESS_3_0("3.0", "3.0mm"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static ThicknessEnum fromCode(String code) {
            for (ThicknessEnum thickness : ThicknessEnum.values()) {
                if (thickness.getCode().equals(code)) {
                    return thickness;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 表面处理枚举
     */
    @Getter
    @AllArgsConstructor
    public enum SurfaceTreatmentEnum {
        HASL_LEADED("HASL_LEADED", "有铅喷锡"),
        HASL_LEAD_FREE("HASL_LEAD_FREE", "无铅喷锡"),
        OSP("OSP", "OSP"),
        IMMERSION_GOLD("IMMERSION_GOLD", "沉金"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static SurfaceTreatmentEnum fromCode(String code) {
            for (SurfaceTreatmentEnum treatment : SurfaceTreatmentEnum.values()) {
                if (treatment.getCode().equals(code)) {
                    return treatment;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 阻焊枚举
     */
    @Getter
    @AllArgsConstructor
    public enum SolderMaskEnum {
        GREEN("GREEN", "绿油"),
        WHITE("WHITE", "白油"),
        BLACK("BLACK", "黑油"),
        BLUE("BLUE", "蓝油"),
        YELLOW("YELLOW", "黄油"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static SolderMaskEnum fromCode(String code) {
            for (SolderMaskEnum mask : SolderMaskEnum.values()) {
                if (mask.getCode().equals(code)) {
                    return mask;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 字符枚举
     */
    @Getter
    @AllArgsConstructor
    public enum CharacterEnum {
        WHITE("WHITE", "白字"),
        BLACK("BLACK", "黑字"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static CharacterEnum fromCode(String code) {
            for (CharacterEnum character : CharacterEnum.values()) {
                if (character.getCode().equals(code)) {
                    return character;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 铜厚枚举
     */
    @Getter
    @AllArgsConstructor
    public enum CopperEnum {
        COPPER_0_5OZ("0.5OZ", "0.5oz"),
        COPPER_1OZ("1OZ", "1oz"),
        COPPER_1_5OZ("1.5OZ", "1.5oz"),
        COPPER_2OZ("2OZ", "2oz"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static CopperEnum fromCode(String code) {
            for (CopperEnum copper : CopperEnum.values()) {
                if (copper.getCode().equals(code)) {
                    return copper;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 过孔工艺枚举
     */
    @Getter
    @AllArgsConstructor
    public enum ViaProcessEnum {
        VIA_COVERED("VIA_COVERED", "过孔盖油"),
        VIA_PLUGGED("VIA_PLUGGED", "过孔塞油"),
        VIA_OPEN("VIA_OPEN", "过孔开窗"),
        RESIN_PLUGGED("RESIN_PLUGGED", "树脂塞油"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static ViaProcessEnum fromCode(String code) {
            for (ViaProcessEnum process : ViaProcessEnum.values()) {
                if (process.getCode().equals(code)) {
                    return process;
                }
            }
            return OTHER;
        }
    }
    
    /**
     * 测试枚举
     */
    @Getter
    @AllArgsConstructor
    public enum TestingEnum {
        FLYING_PROBE("FLYING_PROBE", "飞针测试"),
        TEST_FIXTURE("TEST_FIXTURE", "测试架"),
        OTHER("OTHER", "其它");
        
        private final String code;
        private final String description;
        
        public static TestingEnum fromCode(String code) {
            for (TestingEnum testing : TestingEnum.values()) {
                if (testing.getCode().equals(code)) {
                    return testing;
                }
            }
            return OTHER;
        }
    }
} 